<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <#assign base=request.contextPath  />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title></title>
    <link rel="stylesheet" href="${base}/frame/layui/css/layui.css">
    <link rel="stylesheet" href="${base}/frame/static/css/style.css">
    <link rel="icon" href="${base}/frame/static/image/code.png">
    <script type="text/javascript" src="${base}/frame/layui/layui.all.js"></script>
</head>
<body class="body">
<div class="ziyemianbiju">
	<div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
        <div class="my-btn-box">          
            <span style="height: 50px;">
                 <#--<label class="layui-form-label">充电时间</label>-->
                	<#--<div class="layui-input-inline">-->
				      <#--<input class="layui-input test-item" id="test1"  placeholder="开始时间" type="text" style="height: 31px;">-->
				    <#--</div>-->
				    <#--<div class="layui-input-inline">-->
				      <#--<input class="layui-input test-item" id="test2" placeholder="结束时间" type="text" style="height: 31px;">-->
				    <#--</div>-->
				
                <div class="layui-input-inline">
                	<label class="layui-form-label">用户账户</label>
                    <input type="text" autocomplete="off" placeholder="请输入用户账户" class="layui-input" id="phone" style="width: 150px;height: 31px;margin-top: 4px;">
                </div>
                <a class="layui-btn  layui-btn-sm layui-btn-normal" id="seche22" >查询</a>
            </span>
			<table class="layui-hide" id="test" lay-filter="test"></table>  
		</div>
	</div>
    <script src="${base}/js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript">
layui.use(['laydate','form','table'], function(){
    var laydate = layui.laydate;
    var form = layui.form
    var table = layui.table;
  table.render({
    even: true,//开启隔行背景
	size: 'sm',//小尺寸的表格
	elem: '#test',
    toolbar: '#toolbarDemo',
	url: '${base}/comChargeInfo/list3',
	title: '用户数据表',
	cols: [[
        {field:'id',templet:function(val){ //显示序号而不是id
            return   val.LAY_INDEX
        }, title: '序号'}
        ,{field:'phone', title: '充电用户',align: 'center'}
        ,{field:'remark', title: '备注',align: 'center'}
        ,{field:'soc', title: '电池剩余电量',align: 'center'}
        ,{field:'connectorinfoId', title: '充电桩（枪）id',align: 'center'}
        ,{field:'startTime', title: '开始时间',align: 'center'}
        // ,{field:'samplingTime', title: '本次采样时间',align:'center'}
        ,{field:'endTime', title: '结束时间',align:'center'}
        ,{field:'totalPower', title: '累计消耗电量',align: 'center'}
        ,{field:'elecMoeny', title: '累计电费',align: 'center'}
        ,{field:'totalMoeny', title: '累计总金额',align:'center'}
        ,{field:'serviceMoeny', title: '累计服务费',align:'center'}
    ]]
    ,id: 'testReload'
      ,height:480
      ,page: {
          layout: ['limit', 'count', 'prev', 'page', 'next', 'skip']
          ,theme: '#9AC747'
          ,limit: 10
      }
  });
    laydate.render({
    elem: '#test1'
    ,theme: '#393D49'
  });
  laydate.render({
    elem: '#test2'
    ,theme: '#393D49'
  });
});

//键盘事件
$("body").bind("keydown",function(e){
    // 兼容FF和IE和Opera
    var theEvent = e || window.event;
    var code=theEvent.keyCode || theEvent.which || theEvent.charCode;
    if (code==13) {
        //回车执行查询
        $("#seche22").click();
    }
});
$('#seche22').on('click',function () {
//    var date1 = $("#test1").val();
//    var date2 = $("#test2").val();
    var phone = $("#phone").val();
<#--if (date1 != "" && date2 != "") {-->
<#--var date1 = new Date($("#test1").val());-->
<#--var date2 = new Date($("#test2").val());-->
<#--var phone = $("#phone").val();-->
<#--var table = layui.table;-->
<#--//表刷新方法-->
<#--table.reload(-->
<#--'testReload', {-->
<#--url: '${base}/comChargeInfo/search',-->
<#--where: {startTime: date1.getTime(), endTime: date2.getTime(), phone: phone} //设定异步数据接口的额外参数-->
<#--});-->
<#--}-->

<#--if (date1 == "" && date2 == "" && phone == "")-->
<#--window.location.href = "${base}/comChargeInfo/main.html";-->

//    if (phone != "" && date2 == "" && date1 == "") {
    var table = layui.table;
    table.reload(
            'testReload', {
                url: '${base}/comChargeInfo/search',
                where: {phone: phone} //设定异步数据接口的额外参数
            });
//}
//    if (date1!="" && date2=="" ) alert("请输入结束时间");
//    if (date1=="" && date2!="")  alert("请输入开始时间");
})


</script>
</body>
</html>